package com.witmore.skyline.web.service.third.yjx.client;

import com.witmore.skyline.web.service.third.constants.ApiClientCommonConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;

/**
 * Description: ApiClient 第三方接口调用-登录获取token
 * Author: 豆子高
 * Date: 2025/2/24 14:26
 */
@Slf4j
public class ApiTokenClient {


    /**
     * 获取token
     *
     * @return
     * @throws Exception
     * @response {\"success\":true,\"code\":800,\"message\":null,\"devMsg\":null,\"result\":\"F0AC7AA7C2BBF1B9BC052B49DD46AEDC\",\"page\":null}
     */
    public static String getTokenParsing() throws Exception {
        String urlString = String.format(ApiClientCommonConstant.API_PREFIX + ApiClientCommonConstant.GET_TOKEN_PATH);
        String responseResult = ApiClient.responseHandle(urlString, "获取token接口");
        if (ObjectUtils.isEmpty(responseResult)){
            log.error("获取token接口调用失败");
            throw new Exception("获取token接口调用失败");
        }
        return responseResult;
    }

}
